package ${projectDomain}.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.unswift.annotation.api.Api;
import com.unswift.annotation.api.ApiField;
import com.unswift.annotation.api.ApiMethod;
import ${projectDomain}.adapter.system.SystemFormValidateAdapter;
import ${projectDomain}.pojo.bo.system.form.validate.SystemFormValidateCreateBo;
import ${projectDomain}.pojo.bo.system.form.validate.SystemFormValidateDeleteBo;
import ${projectDomain}.pojo.bo.system.form.validate.SystemFormValidatePageBo;
import ${projectDomain}.pojo.bo.system.form.validate.SystemFormValidateUpdateBo;
import ${projectDomain}.pojo.bo.system.form.validate.SystemFormValidateViewBo;
import ${projectDomain}.pojo.dao.system.form.validate.SystemFormValidateDataDo;
import ${projectDomain}.pojo.dao.system.form.validate.SystemFormValidateDeleteDo;
import ${projectDomain}.pojo.dao.system.form.validate.SystemFormValidateInsertDo;
import ${projectDomain}.pojo.dao.system.form.validate.SystemFormValidatePageDo;
import ${projectDomain}.pojo.dao.system.form.validate.SystemFormValidateSingleDo;
import ${projectDomain}.pojo.dao.system.form.validate.SystemFormValidateUpdateDo;
import ${projectDomain}.pojo.vo.page.PageVo;
import ${projectDomain}.pojo.vo.system.form.validate.SystemFormValidateCreateVo;
import ${projectDomain}.pojo.vo.system.form.validate.SystemFormValidateDeleteVo;
import ${projectDomain}.pojo.vo.system.form.validate.SystemFormValidatePageVo;
import ${projectDomain}.pojo.vo.system.form.validate.SystemFormValidateUpdateVo;
import ${projectDomain}.pojo.vo.system.form.validate.SystemFormValidateViewVo;

@Service
@Api(value="系统表单验证服务", author="unswift", date="2023-08-13", version="1.0.0")
public class SystemFormValidateService extends BaseService{
	
	@Autowired
	@ApiField("系统表单验证公共服务")
	private SystemFormValidateAdapter systemFormValidateAdapter;
	
	@ApiMethod(value="查询系统表单验证分页数据", params=@ApiField("分页对象，包含分页信息及查询条件"), returns=@ApiField("包含查询数据的分页对象"))
	public PageVo<SystemFormValidatePageVo> findPageList(SystemFormValidatePageBo searchBo){
		SystemFormValidatePageDo search=this.convertPojo(searchBo, SystemFormValidatePageDo.class);//将Bo转换为So
		search.setFirstSize((search.getCurrPage()-1)*search.getPageSize());
		PageVo<SystemFormValidateDataDo> page=systemFormValidateAdapter.findPageList(search);//将Do转换为Vo
		return this.convertPage(page, SystemFormValidatePageVo.class);
	}
	
	@ApiMethod(value="查询系统表单验证详情", params=@ApiField("详情业务实体，包含id字段"), returns=@ApiField("系统表单验证详情数据"))
	public SystemFormValidateViewVo view(SystemFormValidateViewBo viewBo){
		SystemFormValidateSingleDo search=this.convertPojo(viewBo, SystemFormValidateSingleDo.class);
		SystemFormValidateDataDo single=systemFormValidateAdapter.findSingle(search);
		return this.convertPojo(single, SystemFormValidateViewVo.class);//将Do转换为Vo
	}

	@ApiMethod(value="创建系统表单验证", params=@ApiField("创建的业务实体"), returns=@ApiField("创建结果{0：未创建，1：已创建}"))
	public SystemFormValidateCreateVo create(SystemFormValidateCreateBo createBo){
		SystemFormValidateInsertDo insert=this.convertPojo(createBo, SystemFormValidateInsertDo.class);//将Bo转换为Po
		int result=systemFormValidateAdapter.save(insert, true);
		return new SystemFormValidateCreateVo(result);
	}
	
	@ApiMethod(value="更新系统表单验证", params=@ApiField("更新的业务实体"), returns=@ApiField("更新结果{0：未创建，1：已创建}"))
	public SystemFormValidateUpdateVo update(SystemFormValidateUpdateBo updateBo){
		SystemFormValidateUpdateDo update=this.convertPojo(updateBo, SystemFormValidateUpdateDo.class);//将Bo转换为Po
		int result=systemFormValidateAdapter.update(update, true);
		return new SystemFormValidateUpdateVo(result);
	}
	
	@ApiMethod(value="删除系统表单验证", params=@ApiField("删除业务实体，包含id字段"), returns=@ApiField("删除结果{0：未创建，1：已创建}"))
	public SystemFormValidateDeleteVo delete(SystemFormValidateDeleteBo deleteBo){
		SystemFormValidateDeleteDo delete=this.convertPojo(deleteBo, SystemFormValidateDeleteDo.class);//将Bo转换为Po
		int result=systemFormValidateAdapter.delete(delete);
		return new SystemFormValidateDeleteVo(result);
	}
}
